<template>
  <div id="left_id">
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      background-color="#FF5D3E"
      text-color="#fff"
      active-text-color="#fff"
      router
    >
      <el-menu-item index="/index">
        <i class="el-icon-school icon"></i>
        <span slot="title">首页</span>
      </el-menu-item>
       <el-submenu :index="menu.title" v-for="menu in menu_list" :key="menu.id">
        <template slot="title">
          <i :class="menu.icon"></i>
          <span>{{ menu.title }}</span>
        </template>
        <el-menu-item-group>
          <el-menu-item :index="m.url" v-for="m in menu.children" :key="m.id">{{ m.title }}</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>

<script>
import { mapMutations, mapState } from 'vuex';
export default {
  created(){
    this.MenuListMutations()
  },
  methods: {
    ...mapMutations('NavStore',['MenuListMutations'])
  },
  computed:{
    ...mapState({'menu_list': state=>state.NavStore.menu_list})
  }
};
</script>

<style>
.el-menu-vertical-demo >li {
   text-align: left;
   font-weight: 400;
   
}
.icon{
    color: #fff !important;
}
</style>